$(warning KERNELRELEASE=$(KERNELRELEASE))
ifeq ($(KERNELRELEASE),)

# MYGCC := arm-buildroot-linux-gnueabi-gcc
# MAKE_ENV := ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
# KERNELDIR ?=  /home/sandui/Downloads/licheepinano/Linux
MYGCC := gcc
MAKE_ENV :=
KERNELDIR ?= /lib/modules/5.15.77-amd64-desktop/build #本地开发



PWD := $(shell pwd) #获取路径

modules:
	$(MAKE) $(MAKE_ENV) -C  $(KERNELDIR) M=$(PWD) modules
	$(MYGCC) test_write.c -o test_write
	$(MYGCC) test_read.c -o test_read
	rm -rf *.o *~ core .depend .*.cmd  *.mod *.mod.c .cache.mk .tmp_versions Module* modules*

modules_install:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod *.mod.c .cache.mk .tmp_versions Module* modules* 
	rm -rf test_write test_read

.PHONY: modules modules_install clean


else 
	obj-m += hello.o
endif

